package com.why.jvm.hotspot.src.share.vm.oops;

import com.why.jvm.hotspot.src.share.vm.oops.constants.ConstantUtf8Info;
import lombok.Data;

/**
 * @author xiaoTian
 * @date 2022/7/16 14:53
 * @Description:
 */
@Data
public class AttributeInfo {

    private ConstantPool constantPool;

    private int attributeNameIndex;

    private int attributeLength;


    public String getAttributeName(){
        return ((ConstantUtf8Info) constantPool.getConstantPoolMap().get(attributeNameIndex)).getValue();
    }

    @Override
    public String toString() {
        return "AttributeInfo{" +
                ", attributeNameIndex=" + attributeNameIndex +'\n'+
                ", attributeName=" + getAttributeName() +'\n'+
                ", attributeLength=" + attributeLength +'\n'+
                '}';
    }
}
